
<br/>
<br/>
<br/>
<div id="info_name">Information for <b><?php echo $data["std_name"]; ?></b></div>
<div id="edit_student">
<table name="edit_student" id="edit_student" border="0" cellpadding="0" cellspacing="0">
	<?php echo form_open('home/encoder_updateRegInfo');?>
	<tr>
		<td>Curriculum taken: </td>
		<td>
			<?php 	
				$std_curriculum = array(
					'BSCS-SP-PR-2008' => 'BSCS-SP-PR-2008',
					'BSCS-SP-PR-2011' => 'BSCS-SP-PR-2011'
				);
				$key = array_search($data["std_curriculum"], $std_curriculum);
				echo form_dropdown('std_curriculum', $std_curriculum, $key);
			?>
		</td>
	</tr>
	<tr>
		<td>Registration adviser: </td>
		<td>
			<?php 
				$advisers = array_combine($data["adviser_names"], $data["adviser_names"]);
				$key = array_search($data["reg_adviser"], $advisers);
				echo form_dropdown('reg_adviser', $advisers, $key);
			?>
		</td>
	</tr>
	<tr>
		<td>SP adviser: </td>
		<td>
			<?php 	
				$advisers = array_combine($data["adviser_names"], $data["adviser_names"]);
				$key = array_search($data["sp_adviser"], $advisers);
				echo form_dropdown('sp_adviser', $advisers, $key);
			
			?>
		</td>
	</tr>
	<tr>
		<?
			echo form_hidden('std_num', $data["std_num"]);
			echo form_hidden('std_id', $data["std_id"]);	
		?>
		<td><input type="submit" value="Update Registration Info" name="encoder_updateRegInfo" class="sub_button" /></td>
	</tr>
	<?php echo form_close();?>
	<tr>
		<td colspan="2">Subjects taken: </td>
		<div id="edit_subjects">
		<table name="all_subjects" id="all_subjects" border="0" cellpadding="0" cellspacing="0">
			<th>Course Code</th>
			<th>Date Taken</th>
			<th>Grade</th>
			<th>Units</th>
			<th>Type</th>
			<?php
				$y =0;
				$course_codes = array();
				foreach ($data["subjects"] as $subject) 
				{
					$string = preg_replace('/\s+/', '', $subject["course_code"]);
					$course_code_trimmed = $string;
					$std_num = $data["std_num"];
					$sem = $subject["sem_taken"];
					$course_id = $std_num."_".$sem."".$subject["yr_taken"]."_".$course_code_trimmed;
					$course_codes[$y] = $course_id;
					$y++;
				}
				$y=0; 
				foreach ($data["subjects"] as $subject) 
				{
				?>
				<?php 
					echo form_open('home/encoder_updateRow');
					echo form_hidden('course_codes', $course_codes);
					echo form_hidden('value', $y);
				?>
			<tr>
				<td><center>
					<?php 	
						echo $subject["course_code"];
					?>
				</center></td>
				<td><center>
					<?php
						if ($subject["sem_taken"] == "01")$sem = "1st semester";
						else if($subject["sem_taken"] == "02") $sem = "2nd semester";
						else if($subject["sem_taken"] == "03") $sem = "Summer";
						echo $sem." ".$subject["yr_taken"];
					?>					
				</center></td>
				<td><center>
					<?php
						$grades = array(
							'1.00' => '1.00',
							'1.25' => '1.25',
							'1.50' => '1.50',
							'1.75' => '1.75',
							'2.00' => '2.00',
							'2.25' => '2.25',
							'2.50' => '2.50',
							'2.75' => '2.75',
							'3.00' => '3.00',
							'4.00' => '4.00',
							'INC' => 'INC',
							'DRP' => 'DRP',
							'5.00' => '5.00'
						);
						$key = array_search($subject["grade"], $grades);
						echo form_dropdown('grade', $grades, $key);
					?>					
				</center></td>
				<td><center>
					<?php
						$units = array(
							'0.00' => '0.00',
							'1.00' => '1.00',
							'2.00' => '2.00',
							'3.00' => '3.00',
							'5.00' => '5.00'
						);
						$key = array_search($subject["units"], $units);
						echo form_dropdown('unit', $units, $key);
					?>					
				</center></td>				
				<td><center>
					<?php
						$types = array(
							'Elective' => 'Elective',
							'GE'	   => 'GE',
							'Major'    => 'Major',
							'PE'    => 'PE',
							'NSTP'    => 'NSTP',
							'Extra'    => 'Extra'
						);
						$key = array_search($subject["type"], $types);
						echo form_dropdown('type', $types, $key);
						
					?>					
				</center></td>				
					<td><input type="submit" value="Edit" name="encoder_update" class="sub_button" /></td>
					<td><a href="encoder_deleteRow?rowId=<?=$course_codes[$y]?>&stdid=<?=$data["std_id"]?>"><input type="button" value="Delete" name="encoder_delete" class="sub_button" onclick="return confirm_encoder_subject_delete();" /></a></td>
			</tr>
			<tr>
				<?
					echo form_hidden('std_id', $data["std_id"]);
					echo form_close();
					$y++;
				}
				?>
			</tr>
		</table> 
		<tr>
			<td>    
				<INPUT type="button" value="Add New Subject" onclick="addRow('dataTable')" /> 
    			<TABLE id="dataTable" width="350px"></TABLE>
    		</td>
    	</tr>
		</table>	
	</div>
	</div>
	</tr>

</table>